package com.hospital.yygh.user.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@MapperScan("com.hospital.yygh.user.mapper")
public class UserConfig {

    /**
     * 分页插件，这个方法(PaginationInterceptor)在高版本springboot中已经过时了
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        // mp插件接口
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        // 添加乐观锁插件
        interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
        return interceptor;
    }


}
